﻿using Architecture.Domain;
using Architecture.Repository.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Architecture.Repository.Impl
{
    public class RoleRepository : BaseRepository<Role>, IRoleRepository
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="context"> 数据库上下文 </param>
        public RoleRepository(EFCoreContext context) : base(context)
        {

        }

        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public async Task<int> AddAsync(Role role)
        {
            return await base.AddAsync(role);
        }

        /// <summary>
        /// 修改角色/删除角色 
        /// </summary>
        /// <param name="role"></param>
        /// <returns></returns>
        public async Task<int> UpdateAsync(Role role)
        {
            return await base.UpdateAsync(role);
        }

        /// <summary>
        /// 查询所有角色
        /// </summary>
        /// <returns></returns>
        public async Task<List<Role>> GetAllAsync()
        {
            return await base.GetAllAsync();
        }

        /// <summary>
        /// 反填角色信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<Role> GetModelAsync(int id)
        {
            return await base.GetModelAsync(id);
        }

        /// <summary>
        /// 条件查询角色信息
        /// </summary>
        /// <param name="expre"></param>
        /// <returns></returns>
        public async Task<List<Role>> GetAsync(Expression<Func<Role,bool>> expre)
        {
            return await base.GetAsync(expre);
        }

    }
}
